package com.brain.activity;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class MainActivity extends Activity implements View.OnTouchListener {
	private ImageButton  brain_btn;
	private ImageButton  healing_game_btn;
	private ImageButton  my_page_btn;
	private ImageButton  tutorial_btn;
	private ImageButton  setting_btn;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        brain_btn 			= (ImageButton) findViewById(R.id.brain_btn);
        healing_game_btn 	= (ImageButton) findViewById(R.id.healing_game_btn);
        my_page_btn 		= (ImageButton) findViewById(R.id.my_page_btn);
        tutorial_btn 		= (ImageButton) findViewById(R.id.tutorial_btn);
        setting_btn 		= (ImageButton) findViewById(R.id.setting_btn);
        
        brain_btn.setOnTouchListener(MainActivity.this);
        healing_game_btn.setOnTouchListener(MainActivity.this);
        my_page_btn.setOnTouchListener(MainActivity.this);
        tutorial_btn.setOnTouchListener(MainActivity.this);
        setting_btn.setOnTouchListener(MainActivity.this);
       

   }
    
    
    public boolean onTouch(View v, MotionEvent event) {
		// TODO Auto-generated method stub
		 if(v == brain_btn) {  
			if (event.getAction() == MotionEvent.ACTION_DOWN) {
			} else if (event.getAction() == MotionEvent.ACTION_UP) {
				Intent intent = new Intent(this, ConnectActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
				intent.putExtra("TYPE", "BRAIN_VIEW");
				startActivity(intent);
			}
		} else if(v == healing_game_btn) {  
			if (event.getAction() == MotionEvent.ACTION_DOWN) {
			} else if (event.getAction() == MotionEvent.ACTION_UP) {
				Intent intent = new Intent(this, ConnectActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
				intent.putExtra("TYPE", "HEALING_GAME");
				startActivity(intent);
			}					
		} else if(v == my_page_btn) {  
			if (event.getAction() == MotionEvent.ACTION_DOWN) {
			} else if (event.getAction() == MotionEvent.ACTION_UP) {
			}
		} else if(v == tutorial_btn) {  
			if (event.getAction() == MotionEvent.ACTION_DOWN) {
			} else if (event.getAction() == MotionEvent.ACTION_UP) {
				Intent intent = new Intent(this, HelpActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
				startActivity(intent);			
		
			}
		} else if(v == setting_btn) {  
			if (event.getAction() == MotionEvent.ACTION_DOWN) {
			} else if (event.getAction() == MotionEvent.ACTION_UP) {
				Intent intent = new Intent(this, SettingActivity.class);
				intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
				startActivity(intent);			
			}
		}
		return false;
	}
	@Override
	protected void onRestart() {
		// TODO Auto-generated method stub
		super.onRestart();
    }	     
}
